
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="/css/main.css" rel="stylesheet" type="text/css" >
<script src="/scripts/store.js" type="text/javascript"></script>
<TITLE><?=$title?></TITLE>


</HEAD>

<BODY>


 <DIV id="RegPanel" style="display:none;position:absolute; left: 17.3%; top: 2.4em; background-color:#EFEDD9; padding:10px;border: outset 1px">
    <FORM action="/registration" method="post" style="padding:0;margin:0;font-size:0.8em" onsubmit="return validate_form(this)">
      <DIV>Имя и фамилия</DIV>
      <INPUT name="name" type="text" size="25">
      <DIV class="form_title">Логин</DIV>
      <INPUT name="login" type="text" size="25">
      <DIV><I>Используйте адрес электронной<BR> почты в качестве логина</I></DIV>
      <DIV class="form_title">Пароль</DIV>
      <INPUT name="pass" type="password" size="25" >
      <DIV><I>Не менее 4 символов</I></DIV><BR>
      <INPUT value="Зарегистрироваться" type="submit" class="form_title">
    </FORM>
</DIV>



 <DIV id="LoginPanel" style="display:none;position:absolute; left: 34%; top: 2.4em; background-color:#EFEDD9; padding:10px;border: outset 1px">
    <FORM action="/registration/login" method="post" style="padding:0;margin:0;font-size:0.8em">
      <DIV>Логин</DIV>
      <INPUT name="login" type="text" size="25" class="">
      <DIV class="form_title">Пароль</DIV>
      <INPUT name="pass" type="password" size="25"><BR>
      <INPUT value="Вход" type="submit" class="form_title"><br><br>
      <DIV><a href="/registration/lost">Забыли пароль?</a></DIV>
    </FORM>
</DIV>



<DIV class="all">



<TABLE width="100%" border="0" cellpadding="0" cellspacing="0" id="main" >
  <TR>
  	<TD width="16%" valign="top" style="padding: 10px 0 10px 10px;">
      <SMALL>Интернет-магазин<BR>рыболовных снастей</SMALL>
    </TD>
 
 <? if(!$this->session->userdata('logged_in')) { ?>
        <TD valign="top" width="16%">
  <? }else{ ?>
        <TD valign="top" width="32%" colspan="2">
  <? }?>
   
      <DIV class="top_login_div">
        <DIV style="padding: 10px 10px 10px 10px"><SMALL>
       <? if(!$this->session->userdata('logged_in')) { ?>
          <A href="#" onclick="return ToggleRegPanel()">Регистрация</A></SMALL>
       <? }else{ ?>
           <?
           $username=$this->session->userdata('id');
           $query = $this->db->query("SELECT name FROM users WHERE id='$username' LIMIT 1");
           $row = $query->row();
           
           if($query->num_rows() != 0){
           ?>
           
                  <? if($this->uri->segment(2)==edit && $this->uri->segment(1)=='registration'){?>
                        <?=$row->name?>
                  <?}else{?>
                       <a href="/registration/edit"><?=$row->name?></a> 
                  <?}?> 
          
          <?}else{?>
          <A href="#" onclick="return ToggleRegPanel()">Регистрация</A></SMALL>
          <?}?>

        <? } ?>   
        </SMALL></DIV>
      </DIV>
    </TD>
    

    
  <? if(!$this->session->userdata('logged_in')) { ?>   
    <TD valign="top" width="16%">
        <DIV class="top_login_div">  
          <DIV style="padding: 10px 10px 10px 10px">
       <? IF(!$this->session->userdata('logged_in')) { ?>
          <SMALL><A href="#"  onclick="return ToggleLoginPanel()">Вход с паролем</A></SMALL>
       <? } ?>
   
          </DIV>
        </DIV>
    </TD>
    
  <? } ?>  
    


   <TD valign="top" width="16%">
     <DIV class="top_login_div"> 
       <DIV style="padding: 10px 10px 10px 10px">
       <SMALL>
       
     
         <? if($this->session->userdata('logged_in')) { ?>  
            <a href="/registration/logout">Выход</a>
         <? }else{ ?>
            &nbsp;
         <? } ?>
         

       </SMALL>
       </DIV>
     </DIV>
   </TD>
 


  

<TD valign="top" width="8%">
  <DIV class="top_login_div">
  <DIV style="padding: 10px 10px 10px 10px">
  <SMALL>
  
  <?
    $session=$this->session->userdata('session_id');
  		  $query = $this->db->query("SELECT id FROM session_to_store WHERE session='$session'");
          								
          				if ($query->num_rows() > 0){ ?>
          				  
          				   <? if($this->uri->segment(2)=='add' && $this->uri->segment(1)=='store'){ ?>
          				  <SPAN class="basket">Корзина</SPAN>
          				  <? }else{ ?>
          				  <SPAN class="basket"><a href="/store/add/">Корзина</a></SPAN>
          				  <? } ?>
          				
          				<?
          				
                  }else{
                    echo "&nbsp;";
                  }

  ?>
  

  </SMALL>
  </DIV> 
  </DIV>

</TD>
    
 <TD valign="top" width="24%">
   <DIV style="margin: 0 -10px 0 -10px;"> 
     <DIV style="padding: 10px 10px 7px 10px">
        <TABLE border="0" cellspacing="0" cellpadding="0" >
          <TR>
            <TD style="padding:0;margin:0" width="100%"><INPUT type="search" value="Поиск" style="font-size:0.8em; padding:-10;margin:0;position: relative; width: 100%;"></TD>
            <TD style="padding:0 0 0 5px;margin:0"><INPUT type="submit" value="Поиск" style="font-size:0.8em;"></TD>
          </TR>
        </TABLE>
     </DIV>
   </DIV>
 </TD>
    
</TR>